package com.atguigu.tingshu.album.strategy;


import com.atguigu.tingshu.album.mapper.AlbumStatMapper;
import com.atguigu.tingshu.model.order.OrderInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component("1001")
public class ProcessAlbumPurchases implements ProcessDiffTypePurchases {
    @Autowired
    private AlbumStatMapper albumStatMapper;

    /**
     * 处理专辑类型购买量(数据库)
     *
     * @param orderInfo 订单信息
     */
    @Override
    public void processTypePurchases(OrderInfo orderInfo) {
        Long albumId = orderInfo.getOrderDetailList().get(0).getItemId();
        // 3.修改MySQL(专辑的购买量)
        albumStatMapper.updateAlbumStatNum(albumId, "0403", orderInfo.getOrderDetailList().size());
    }
}